package com.source.lightfowl.barcodeMachineGrantAndRecovery.dao;

import com.source.lightfowl.barcodeMachineGrantAndRecovery.pojo.BarcodeMachineUser;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;

/**
 * @Author: Faink
 * @CreateTime: 2020/8/9 21:41
 */
public interface BarcodeMachineUserDao extends JpaRepository<BarcodeMachineUser,String> {

    BarcodeMachineUser findByBarcodeMachineId(String machineId);

    @Query("select u.isUpdate from BarcodeMachineUser u where u.barcodeMachineId = ?1")
    String findIsupdateByBarcodeMachineId(String machineId);

    @Modifying
    @Query("update BarcodeMachineUser u set u.isUpdate = '0' where u.barcodeMachineId = ?1")
    int setIsupdateByBarcodeMachineId(String machineId);


}
